<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="shortcut icon" href="/favicon.ico"/>
    <link rel="bookmark" href="/favicon.ico"/>
    <link rel="stylesheet"  href="/layuiadmin/layui/css/layui.css" th:href="@{/layuiadmin/layui/css/layui.css}"  media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" th:href="@{/layuiadmin/style/admin.css}" media="all">
    <meta charset="UTF-8">
    <title>行影旅游网</title>
    <style type="text/css">
         body {
               background-size: cover;
               font-size: 16px;
         }

        .form {
            background: rgb(202, 30, 55);
            width: 400px;
            margin: 100px auto;
        }

        #login_form {
            display: block;
        }

        #register_form {
            display: none;
        }

        .fa {
            display: inline-block;
            top: 27px;
            left: 6px;
            position: relative;
            color: #ccc;
        }

        input[type="text"], input[type="password"] {
            padding-left: 26px;
        }


        .checkbox {
            padding-left: 21px;
        }
        .form-group {
            margin-top: -15px;
        }


    </style>

</head>
<body>
<header th:fragment="copyheader">
    <link href="/css/bootstrap.css" th:href="@{/css/bootstrap.css}" rel="stylesheet"/>
    <link href="/css/font-awesome.css" th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
    <link href="/css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link href="/css/select2.css" th:href="@{/css/select2.css}" rel="stylesheet"/>
    <link href="/css/smoothness/jquery-ui-1.10.0.custom.css" th:href="@{/css/smoothness/jquery-ui-1.10.0.custom.css}" rel="stylesheet"/>
    <link href="/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>

    <script src="/js/jquery.js" th:src="@{/js/jquery.js}"></script>
    <script src="/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>

    <script src="/js/jquery-ui.js" th:src="@{/js/jquery-ui.js}"></script>
    <script src="/js/jquery-migrate-1.2.1.min.js" th:src="@{/js/jquery-migrate-1.2.1.min.js}"></script>
    <script src="/js/jquery.easing.1.3.js" th:src="@{/js/jquery.easing.1.3.js}"></script>
    <script src="/js/superfish.js" th:src="@{/js/superfish.js}"></script>

    <script src="/js/select2.js" th:src="@{/js/select2.js}"></script>
    <script src="/js/jquery.parallax-1.1.3.resize.js" th:src="@{/js/jquery.parallax-1.1.3.resize.js}"></script>
    <script src="/js/SmoothScroll.js" th:src="@{/js/SmoothScroll.js}"></script>
    <script src="/js/jquery.appear.js" th:src="@{/js/jquery.appear.js}"></script>
    <script src="/js/jquery.caroufredsel.js" th:src="@{/js/jquery.caroufredsel.js}"></script>
    <script src="/js/jquery.touchSwipe.min.js" th:src="@{/js/jquery.touchSwipe.min.js}"></script>
    <script src="/js/jquery.ui.totop.js" th:src="@{/js/jquery.ui.totop.js}"></script>
    <script src="/js/script.js" th:src="@{/js/script.js}"></script>
    <script th:src="@{/js/jquery.cookie.js}"></script>
    <script th:src="@{/js/love.js}"></script>
    <script type="text/javascript" th:src="@{/js/follower.js}"></script>
    <script type="text/javascript" th:src="@{/js/star.js}"></script>
    <canvas id="canvas"></canvas>
    <div class="top1_wrapper">
        <div class="container">
            <div class="top1 clearfix">
                <div class="email1"><a href="#">travel@xingying.com</a></div>
                <div class="phone1">+917 3386831</div>
                <div class="social_wrapper">
                    <ul class="social clearfix" th:if="${session.user==null}" style="display: inline-block">
                        <li>  <a href="/dist/login" class="btn-default btn2" id="login">登录</a> </li>
                        <li>  <a href="/dist/register" class="btn-default btn2" id="regist">注册</a> </li>
                    </ul>
                    <ul class="social clearfix"  th:if="${session.admin==null && session.user==null}" style="display: inline-block">
                        <li>  <a href="/dist/adminLogin" class="btn-default btn2" id="adminLogin">管理员登录</a>
                        </li>
                    </ul>
                    <ul class="social clearfix" th:if="${session.user!=null}">
                        <li>
                            <label>欢迎你：</label>
                            <input  type="hidden" id="currentUserId" th:value="${session.user.getId()}">
                            <input  type="hidden" id="isVip" th:value="${session.user.getIsVip()}">
                        <span  ><a style="color: #f92c17;float: right;size: 2px" href="#" onclick="userInfo()" th:text="${session.user.getName()}"></a></span>
                        </li>
                        <li>
                            <a  class="btn-default btn2" href="javascript:;" lay-tips="邮件" lay-direction="2" th:text="邮件" onclick="showEmailModel()"></a>
                        </li>
                        <li>
                            <a href="#" class="btn-default btn2" onclick="showModal();">我的订单</a>
                        </li>
                        <li th:if="${session.user.isVip == '0'}">
                            <a href="/gogo/zhifu" class="btn-default btn2" target ="_blank"  th:title="仅需0.1元就能享受终身vip服务">升级为VIP</a>
                        </li>
                        <li th:if="${session.user.isVip == '1'}">
                            <label>积分：</label><span id="score"></span>
                            <a href="#" class="btn-default btn2" onclick="sign();">签到</a>
                        </li>
                        <li>
                            <a href="../user/logout" class="btn-default btn2">注销</a>
                        </li>
                    </ul>
                    <ul class="social clearfix" id="isWeCatShow" style="display: none;">
                        <li>
                            <label>欢迎你：</label>
                            <span ><a style="color: #f92c17;float: right;size: 2px" href="#" id="nickName" onclick="userInfo()"></a>
                            </span>
                        </li>
                        <li>
                            <a href="#" class="btn-default btn2" onclick="showModal();">我的订单</a>
                        </li>
                        <li>
                            <a href="../user/logout" class="btn-default btn2">注销</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="top2_wrapper">
        <div class="container">
            <div class="top2 clearfix">
                <header>
                    <div class="logo_wrapper">
                        <a href="/dist/view" class="logo">
                            <img th:src="@{/images/logo.png}" class="img-responsive">
                        </a>
                    </div>
                </header>
                <div class="navbar navbar_ navbar-default">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <div class="navbar-collapse navbar-collapse_ collapse">
                        <ul class="nav navbar-nav sf-menu clearfix">
                            <li><a href="/dist/index">首页</a></li>
                            <li><a href="/dist/travel">行影旅行</a></li>
                            <li><a href="/dist/gallery">旅行相册</a></li>
                            <li><a href="/dist/hotels">酒店住宿</a>
                            <li><a href="/dist/contacts">联系我们</a></li>
                            <li><a href="/dist/about">关于我们</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!--弹出框-->
    <div class="modal fade" id="login_modal" th:fragment="table_refresh" >
        <div class="modal-dialog" style="width:1200px">
            <div class="modal-content message_align">
                <form id="dologin" name="uploadForm" method="POST" class="form-horizontal" action="../desktop/login" role="form" >
                    <div class="modal-header">
                       <span class="btn"></span>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="closeModal()"><span aria-hidden="true" >×</span></button>
                        <h4 class="modal-title">我的订单</h4>
                        <ul id="myTab" class="nav nav-tabs" role="tablist">
                            <li class="active"><a href="#" id="scenic" onclick="scenic()" role="tab" data-toggle="tab">景点</a></li>
                            <li id="hotelTab"><a href="#" role="tab" id="hotel" onclick="hotel()" data-toggle="tab">酒店</a></li>
                        </ul>
                    </div>
                    <div class="modal-body" >
                        <div class="thumbnail clearfix">
                            <div class="modal-body">
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="form-group" >
                                                <table class="table" id="table">


                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" onclick="closeModal()">取消</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="modal fade" id="email_modal" th:fragment="table_refresh" >
        <div class="modal-dialog" style="width:800px">
            <div class="modal-content message_align">
                <form  name="uploadForm" method="POST" class="form-horizontal" action="../desktop/login" role="form" >
                    <div class="modal-header">
                        <span class="btn"></span>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="closeEmailModal()"><span aria-hidden="true" >×</span></button>
                        <h4 class="modal-title">最近的消息</h4>
                        <ul  class="nav nav-tabs" role="tablist">
                            <li class="active"><a href="#"  onclick="scenicEmail()" role="tab" data-toggle="tab">景点信息</a></li>
                            <li id="hotelEmail"><a href="#" role="tab"  onclick="hotelEmail()" data-toggle="tab">酒店信息</a></li>
                        </ul>
                    </div>
                    <div class="modal-body" >
<!--                        <div class="thumbnail clearfix" style="height: 110px">-->
                            <div class="modal-body">
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="form-group" >
                                                <table id="email" class="table">


                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                       <!-- </div>-->
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" onclick="closeEmailModal()">取消</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="myModal111" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel2">请给我们的服务打分：</h4>
                </div>
                <div><ul class="box" style=" list-style-type: none;">
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                </ul></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" id="submit" class="btn btn-primary">提交更改</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>


    <div class="modal fade" id="myModal11" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel3">请给我们的服务打分：</h4>
                </div>
                <div>
                    <ul class="box" style=" list-style-type: none;">
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                    <li style="float: left;font-size: 50px">☆</li>
                </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" id="submit1" class="btn btn-primary">提交更改</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>


    <!-- 弹框-编辑 -->
    <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header"><h4 class="modal-title" id="myModalLabel">编辑</h4></div>
                <div class="modal-body stu_modal">
                    <div class="form-group"><label>姓名：</label><input type="text" class="form-control" id="stu_name"></div>
                    <div class=""><label>性别：</label><input type="radio" name="sex" value="男" id="man">男<input type="radio" name="sex" value="女" id="woman">女</div><br>
                    <div class="form-group"><label>年龄：</label><input type="text" onkeyup = "value=value.replace(/[^\d]/g,'')" class="form-control" id="stu_age" onchange="checkAge(this)"></div>
                    <div class="form-group"><label>电话：</label><input type="" class="form-control" id="stu_phone" onchange="checkPhone(this)"></div>
                    <div class="form-group"><label>邮箱：</label><input type="email"  class="form-control" id="stu_email" onchange="checkEmail(this)" ></div>
                    <div class="modal-footer"><button type="button" class="btn btn-save" data-dismiss="modal" onclick="change()">提交</button><button type="button" class="btn btn-theme-border" data-dismiss="modal">关闭</button></div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function createTime(v){
            var date = new Date(v);
            var y = date.getFullYear();
            var m = date.getMonth()+1;
            m = m<10?'0'+m:m;
            var d = date.getDate();
            d = d<10?("0"+d):d;
            var h = date.getHours();
            h = h<10?("0"+h):h;
            var M = date.getMinutes();
            M = M<10?("0"+M):M;
            var str = y+"-"+m+"-"+d+" "+h+":"+M;
            return str;
        }
    </script>
    <script type="text/javascript">

        function functionOfcreateTime(v){
            var date = new Date(v);
            var y = date.getFullYear();
            var m = date.getMonth()+1;
            m = m<10?'0'+m:m;
            var d = date.getDate();
            d = d<10?("0"+d):d;
            var h = date.getHours();
            h = h<10?("0"+h):h;
            var M = date.getMinutes();
            M = M<10?("0"+M):M;
            var str = y+"-"+m+"-"+d+" "+h+":"+M;
            return str;
        }
        function showEmailModel() {

            scenicEmail();
        }
        function scenic() {
            showModal();
        }

        function hotel() {
            $.ajax({
                type: "post",
                url: "/fore_hotelOrder/findAllOrders",
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    html="<thead>\n" +
                        "<tr><th>名字</th><th>订单个数</th><th>总钱数</th><th>状态</th><th>订单创建时间</th><th>付款时间</th><th>去付款</th><th>&nbsp;&nbsp;&nbsp;&nbsp;售后</th></tr>\n" +
                        "</thead><tbody>"
                    $.each(result.data,function (index,value) {
                        var scenic=value.scenicId;
                        var orderId=value.id;
                        var createTime = functionOfcreateTime(value.createTime);
                        var paytime = value.paytime;
                        if (paytime != null) {
                            paytime = functionOfcreateTime(value.paytime);
                        } else {
                            paytime = "未支付，请及时支付!!!"
                        }
                        var orderStatus = value.status;
                        if (value.status==0){
                            value.status="待支付";
                        }else if (value.status==1) {
                            value.status="待入住"
                        }else if (value.status==2) {
                            value.status="交易关闭"
                        }else if (value.status==3) {
                            value.status="退款申请中"
                        }else if (value.status==4) {
                            value.status="商家拒绝退款"
                        }else if (value.status==5) {
                            value.status="退款成功，交易关闭"
                        }else if (value.status==6) {
                            value.status="取消申请中"
                        }else if (value.status==7) {
                            value.status="取消成功，交易关闭"
                        }else if (value.status==8) {
                            value.status="退房成功，交易关闭"
                        }else if (value.status==10) {
                            value.status="入住中"
                        }else if (value.status==11) {
                            value.status="安排中"
                        }else if (value.status==12) {
                            value.status="酒店退房申请中"
                        }else if (value.status==13) {
                            value.status="商家拒绝退房"
                        }else if (value.status==14) {
                            value.status="续订未支付"
                        }
                        html=html+"<tr><td>"+value.userName+"</td><td>"+value.qty+"</td><td>"+value.payment+"</td><td>"+value.status+"</td><td>"+createTime+"</td><td>"+paytime+"</td><td><a href='javascript:void(0)' onclick='toPayOrderPage(\""+orderId+"\" , \""+2+"\" , \""+orderStatus+"\")'>去付款</a></td><td><a href='#' onclick='cancelOrder(\""+orderId+"\" , \""+createTime+"\" ,\""+orderStatus+"\" , \""+2+"\" )'>取消</a>&nbsp;<a href='#' onclick='drawback(\""+orderId+"\",\""+orderStatus+"\" , \""+1+"\")'>退款</a>&nbsp;<a href='#' onclick='checkOut(\""+orderId+"\",\""+orderStatus+"\" )'>退房</a>&nbsp;<a href='#' onclick='relet(\""+orderId+"\",\""+orderStatus+"\")'>续租</a></td></tr>";
                    })
                    html=html+"</tbody>";
                    $("#table").html(html)
                    $("#login_modal").modal('show');
                },
                error:function () {
                    alert('请求失败！');
                }
            })
        }

        function scenicEmail() {
            $.ajax({
                type: "post",
                url: "/email/getRecentScenicEmail",
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    html = "<tbody>"
                    $.each(result.data,function (index,value) {
                        var orderId = value.orderId;
                        var emailValue = JSON.stringify(value).replace(/"/g,"’");
                        if (value.isRead == "0") {
                            html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。<i class=\"po\" id=\"red\" style='display: block;\n" +
                                "        background: red;\n" +
                                "        border-radius: 50%;\n" +
                                "        width: 8px;\n" +
                                "        height: 8px;\n" +
                                "        top: -20px;\n" +
                                "        left: 570px;\n" +
                                "        position: relative;'></i></td><td></td><td><a href='javascript:void(0)' onclick='scenicEmailDetail(\"" + emailValue + "\")'>阅读</a></td></tr>"
                        } else {
                            html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。</td><td></td><td><span>已阅</span></td></tr>"
                        }

                    })
                    html = html+"</tbody>"
                    $("#email").html(html)
                    $("#email_modal").modal('show');
                },
                error:function () {
                    alert('请求失败！');
                }
            })
        }

        function hotelEmail() {
            $.ajax({
                type: "post",
                url: "/email/getRecentHotelEmail",
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    html = "<tbody>"
                    $.each(result.data,function (index,value) {
                        var orderId = value.orderId;
                        var emailValue = JSON.stringify(value).replace(/"/g,"’");
                        if (value.isRead == "0") {
                            if (value.emailType == "1") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，订单号为<font color=\"blue\">" + value.orderId + "</font>已被管理员安排入住，请点击确定回复<i class=\"po\" id=\"red\" style='display: block;\n" +
                                    "        background: red;\n" +
                                    "        border-radius: 50%;\n" +
                                    "        width: 8px;\n" +
                                    "        height: 8px;\n" +
                                    "        top: -20px;\n" +
                                    "        left: 570px;\n" +
                                    "        position: relative;'></i></td><td><a href='javascript:void(0)' onclick='determine(\"" + orderId + "\")'>确定入住</a></td><td><a href='javascript:void(0)' onclick='emailDetail(\"" + emailValue + "\")'>阅读</a></td></tr>"
                            } else if (value.emailType == "0") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。<i class=\"po\" id=\"red\" style='display: block;\n" +
                                    "        background: red;\n" +
                                    "        border-radius: 50%;\n" +
                                    "        width: 8px;\n" +
                                    "        height: 8px;\n" +
                                    "        top: -20px;\n" +
                                    "        left: 570px;\n" +
                                    "        position: relative;'></i></td><td></td><td><a href='javascript:void(0)' onclick='emailDetail(\"" + emailValue + "\")'>阅读</a></td></tr>"
                            }else if (value.emailType == "2") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的续订订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。<i class=\"po\" id=\"red\" style='display: block;\n" +
                                    "        background: red;\n" +
                                    "        border-radius: 50%;\n" +
                                    "        width: 8px;\n" +
                                    "        height: 8px;\n" +
                                    "        top: -20px;\n" +
                                    "        left: 570px;\n" +
                                    "        position: relative;'></i></td><td></td><td><a href='javascript:void(0)' onclick='emailDetail(\"" + emailValue + "\")'>阅读</a></td></tr>"
                            }else if (value.emailType == "3") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，订单号为<font color=\"blue\">" + value.orderId + "</font>退房成功。<i class=\"po\" id=\"red\" style='display: block;\n" +
                                    "        background: red;\n" +
                                    "        border-radius: 50%;\n" +
                                    "        width: 8px;\n" +
                                    "        height: 8px;\n" +
                                    "        top: -20px;\n" +
                                    "        left: 570px;\n" +
                                    "        position: relative;'></i></td><td></td><td><a href='javascript:void(0)' onclick='emailDetail(\"" + emailValue + "\")'>详情</a></td></tr>"
                            }
                        } else {
                            if (value.emailType == "1") {
                                html = html + "<tr><td>尊敬的"+value.receiveName+"先生，订单号为<font color=\"blue\">"+value.orderId+"</font>已被管理员安排入住，请点击确定回复</td><td><a href='javascript:void(0)' onclick='determine(\""+orderId+"\")'>确定入住</a></td><td><span>已读</span></td></tr>";
                            }else if (value.emailType == "0") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。</td><td></td><td><span>已读</span></td></tr>"
                            }else if (value.emailType == "2") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，您有一笔新的续订订单，订单号为<font color=\"blue\">" + value.orderId + "</font>。</td><td></td><td><span>已读</span></td></tr>"
                            }else if (value.emailType == "3") {
                                html = html + "<tr><td>尊敬的" + value.receiveName + "先生，订单号为<font color=\"blue\">" + value.orderId + "</font>退房成功。</td><td></td><td><span>已读</span></td></tr>"
                            }
                        }

                    })
                    html = html+"</tbody>"
                    $("#email").html(html)
                    $("#email_modal").modal('show');
                },
                error:function () {
                    alert('请求失败！');
                }
            })
        }

        function determine(orderId) {
            $.ajax({
                type: "post",
                url: "/fore_hotelOrder/determine/"+orderId,
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    if (result.code == 200) {
                        alert(result.msg)
                    } else {
                        alert(result.msg)
                    }
                    $("#email_modal").modal('hide');
                },
                error:function () {
                    alert('请求失败！');
                }
            })
        }
            function scenicEmailDetail(value) {
            value = value.replace(/’/g, `"`);
            value = JSON.parse(value);
            var orderId = value.orderId;
            var order;
            $.ajax({
                type: "post",
                url: "/fore_orders/findByOrderId/"+orderId+"/"+value.id,
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    if (result.code == 200) {
                        order =  result.data.order;
                        scenic =  result.data.scenic;
                        statusDesc = result.data.statusDesc;
                        /*layer.confirm('<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">发送人</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="sendOutName" id="sendOutName" required  lay-verify="required" value="'+value.sendOutName+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">接收人</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="receiveName" id="receiveName" required  lay-verify="required" value="'+value.receiveName+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="width: 100px;text-align: left;">发送时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="sendTime" id="sendTime" required  lay-verify="required" value="'+createTime(value.sendTime)+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">订单号</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="comment" required id="comment"  lay-verify="required" value="'+orderId+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">景点名称</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="stock" id="stock" required  lay-verify="required" value="'+scenic.name+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">订单状态</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="start" id="start" required  lay-verify="required" value="'+statusDesc+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">下单时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text"  name="createTime" id="createTime" required  lay-verify="required" value="'+createTime(order.createTime)+'"  autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>', {btn: ['确认','关闭'] }, function () {
                            /!*  $("#hotelEmail").removeClass('active');
                              $("#hotelTab").removeClass('active');*!/
                            layer.closeAll('dialog');
                        });*/

                    } else {
                        alert(result.msg)
                    }
                },
                error:function () {
                    alert('请求失败！');
                }
            })

        }


        function emailDetail(value) {
            value = value.replace(/’/g, `"`);
            value = JSON.parse(value);
            var orderId = value.orderId;
            var order;

            $.ajax({
                type: "post",
                url: "/fore_hotelOrder/findByOrderId/"+orderId+"/"+value.id,
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                   /* if (result.code == 200) {
                        order =  result.data.order
                        hotel =  result.data.hotel;
                        statusDesc = result.data.statusDesc;
                        layer.confirm('<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">发送人</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="sendOutName" id="sendOutName" required  lay-verify="required" value="'+value.sendOutName+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">接收人</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="receiveName" id="receiveName" required  lay-verify="required" value="'+value.receiveName+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="width: 100px;text-align: left;">发送时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="sendTime" id="sendTime" required  lay-verify="required" value="'+createTime(value.sendTime)+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label" style="text-align: left;">订单号</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="comment" required id="comment"  lay-verify="required" value="'+orderId+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">酒店名称</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="stock" id="stock" required  lay-verify="required" value="'+hotel.name+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">订单状态</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text" name="start" id="start" required  lay-verify="required" value="'+statusDesc+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '  </div>'+
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">下单时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="text"  name="createTime" id="createTime" required  lay-verify="required" value="'+createTime(order.createTime)+'"  autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">入住时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="Date" name="startTime" id="startTime" required  lay-verify="required" value="'+order.startTime+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '<div class="layui-form-item">\n' +
                            '    <label class="layui-form-label"  style="width: 100px;text-align: left;">离开时间</label>\n' +
                            '    <div class="layui-input-block">\n' +
                            '      <input type="Date" name="endTime" id="endTime" required  lay-verify="required" value="'+order.endTime+'" placeholder="请输入" autocomplete="off" class="layui-input" readonly>\n' +
                            '    </div>\n' +
                            '</div>', {btn: ['确认','关闭'] }, function () {
                            /!*  $("#hotelEmail").removeClass('active');
                              $("#hotelTab").removeClass('active');*!/
                            layer.closeAll('dialog');
                        });
                    } else {
                        alert(result.msg)
                    }*/
                },
                error:function () {
                    alert('请求失败！');
                }
            })

        }

        function showModal() {
            $.ajax({
                type: "post",
                url: "/fore_orders/findAllOrders",
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                   /* console.log(result.data)*/
                    html="<thead>\n" +
                        "<tr><th>名字</th><th>订单个数</th><th>景点名称</th><th>总金额</th><th>状态</th><th>订单创建时间</th><th>付款时间</th><th>去付款</th><th>&nbsp;&nbsp;&nbsp;&nbsp;售后</th></tr>\n" +
                        "</thead><tbody>"
                    $.each(result.data,function (index,value) {
                        var orderId=value.id;
                        var createTime = functionOfcreateTime(value.createTime);
                        var paytime = value.paytime;
                        if (paytime != null) {
                            paytime = functionOfcreateTime(value.paytime);
                        } else {
                            paytime = "未支付，请及时支付!!!"
                        }
                        var orderStatus = value.status;
                        if (value.status==0){
                            value.status="待支付";
                        }else if (value.status==1) {
                            value.status="待消费"
                        }else if (value.status==2) {
                            value.status="交易关闭"
                        }else if (value.status==3) {
                            value.status="退款申请中"
                        }else if (value.status==4) {
                            value.status="商家拒绝退款"
                        }else if (value.status==5) {
                            value.status="退款成功，交易关闭"
                        }
                        else if (value.status==6) {
                            value.status="取消申请中"
                        }else if (value.status==7) {
                            value.status="取消成功，交易关闭"
                        }else if (value.status==9) {
                            value.status="景点消费成功，交易关闭"
                        }
                       console.log(value.id+"==="+value.scenicId+"==="+value.qty+"==="+value.payment+"==="+value.status)
                        html=html+"<tr><td>"+value.userName+"</td><td>"+value.qty+"</td><td>"+value.scenicName+"</td><td>"+value.payment+"</td><td>"+value.status+"</td><td>"+functionOfcreateTime(value.createTime)+"</td><td>"+ paytime+"</td><td><a href='javascript:void(0)' onclick='toPayOrderPage(\""+orderId+"\" ,\""+1+"\" , \""+orderStatus+"\")'>去付款</a></td><td><a href='#' onclick='cancelOrder(\""+orderId+"\" , \""+createTime+"\" ,\""+orderStatus+"\" , \""+1+"\" )'>取消</a>&nbsp;<a href='#' onclick='drawback(\""+orderId+"\",\""+orderStatus+"\" , \""+0+"\")'>退款</a>&nbsp;<a href='#' onclick='consume(\""+orderId+"\",\""+orderStatus+"\")'>消费</a>&nbsp;</td></tr>";
                    })
                    html=html+"</tbody>";
                    $("#table").html(html)
                    $("#login_modal").modal('show');
                },
                error:function () {
                    alert('请求失败！');
                }
            })

            //$('#table_refresh').load("/orders/allorders");

        }

        function closeModal() {
            $("#login_modal").modal('hide');
        }

        function closeEmailModal() {
            $("#email_modal").modal('hide');
            location.reload();
        }

        function userInfo(){
            inf()
        }

        function checkAge (obj) {
            var myreg = /^[1-9]{1,3}$/;
            if (!myreg.test(obj.value.trim())) {
                alert("年龄格式不正确！");
                obj.value = '';
                return false;
            } else {
                return true;
            }
        }

        function checkPhone(obj) {
            var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
            if (!myreg.test(obj.value.trim())) {
                alert("手机号码格式不正确！");
                obj.value = '';
                return false;
            } else {
                return true;
            }
        }

        function checkEmail(obj) {
            var myreg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
            if (!myreg.test(obj.value)) {
                alert("邮箱格式不正确！");
                obj.value = '';
                return false;
            } else {
                return true;
            }
        }

        function inf() {
            $.ajax({
                type: "post",
                url: "/dist/info",
                contentType: "application/json",
                dataType:"JSON",
                success:function(result){
                    $("#stu_name").val(result.data.name)
                    if (result.sex=="男"){
                        $("#man").attr("checked","checked")
                    }else {
                        $("#woman").attr("checked","checked")
                    }
                    $("#stu_age").val(result.data.age)
                    $("#stu_email").val(result.data.email)
                    $("#stu_phone").val(result.data.mobile)
                    $("#editModal").modal('show');
                },
                error:function () {
                    alert('请求失败！');
                }
            })
        }


        function change() {
                var name=$("#stu_name").val()
                var sex=$('input:radio[name="sex"]:checked').val();
                var age=$("#stu_age").val()
                var mobile=$("#stu_phone").val()
                var email=$("#stu_email").val()
                var data = JSON.stringify({name:name,sex:sex,age:age,mobile:mobile,email:email})
                $.ajax({
                    type: "post",
                    url: "/user/change",
                    data: data,
                    contentType: "application/json; charset=utf-8",
                    dataType:"JSON",
                    success:function(result){
                        if (result.code==200){
                            alert("修改成功,相关信息已更新，请重新登录！")
                            location.href = '/user/logout';
                        }else {
                            alert(result.msg)
                        }
                        $("#editModal").modal('hide');
                    },
                    error:function () {
                        alert('修改失败！');
                    }
                })
        }


        function star(orderId , scenicId) {
            $("#myModal111").modal('show');
            opinions(orderId , scenicId)
        }

        //退款申请
        function drawback(id , orderStatus , orderType) {
            if (orderStatus != '1') {
                alert("当前订单状态下不可申请退款")
                /*layer.msg(
                   "当前订单状态下不可取消订单",{
                        icon: 1
                    });*/
                return;
            }
            $.ajax({
                url:"/foreCheckingTask/drawback",
                type:"post",//请求类型
                data:"orderId="+id+"&orderType="+orderType,
                contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                dataType:"json",//服务端返回给浏览器的数据类型
                success:function (res) {
                    if(res.code == 200) {
                        alert("退款申请成功，请留意结果")
                        /*layer.msg(
                            res.msg,{
                                icon: 1
                            });*/
                        $("#login_modal").modal('hide');
                    } else {
                        layer.msg(
                            res.msg,{
                                icon: 1
                            });
                    }
                }
            });
        }
        //续租
        function relet(orderId , orderStatus) {
            if (orderStatus == "1" || orderStatus == "10" || orderStatus == "11") {
                layer.confirm(
                    '<div>\n' +
                    '<label>续租天数 :</label>\n' +
                    '<button onClick="var result = document.getElementById(\'dayNum\'); var qty = result.value; if( !isNaN( qty ) &amp;&amp; qty &gt; 1 ) result.value--;return false;" class="reduced items-count" type="button"><i class="fa fa-minus">&nbsp;</i></button>\n' +
                    '<input type="text"  class="input-text qty" title="dayNum" value="1" maxlength="12" id="dayNum" name="dayNum">\n' +
                    '<button  onClick="var result = document.getElementById(\'dayNum\'); var qty = result.value; if( !isNaN( qty )) result.value++;return false;" class="increase items-count" type="button"><i class="fa fa-plus">&nbsp;</i></button>\n' +
                    '</div>',{btn:['确定','取消']},function (index,layero) {
                        var dayNum=$("#dayNum").val()
                        console.log("====--==="+dayNum+'\n')

                        $.ajax({
                            type: "PUT",
                            url: "/fore_hotelOrder/relet/"+ orderId ,
                            data: JSON.stringify({"dayNum":dayNum}),
                            dataType: "json",
                            contentType: "application/json;charset=utf-8",
                            success: function(result) {
                                if(result.code == 200) {
                                    layer.msg(result.msg,{icon: 1});
                                    setTimeout(function(){
                                        window.location.reload(true)
                                    },1000);
                                } else {
                                    layer.msg(result.msg, {
                                        icon: 5
                                    });
                                }
                            }
                        });
                    })
            } else {
                alert("当前订单状态下不可续定")
                return;
            }


        }
        //酒店退房
        function checkOut(id , orderStatus) {
            if (orderStatus != '10') {
                alert("当前订单状态下不可申请退房")
            } else  {
                $.ajax({
                    url:"/foreCheckingTask/checkOut",
                    type:"post",//请求类型
                    data:"orderId="+id,
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    dataType:"json",//服务端返回给浏览器的数据类型
                    success:function (res) {
                        if(res.code == 200) {
                            alert(res.msg)
                            setTimeout(function(){
                                window.location.reload(true)
                            },1000);
                            /*layer.msg(
                                res.msg,{
                                    icon: 1
                                });*/
                        } else {
                            alert(res.msg)
                            /* layer.msg(
                                 res.msg,{
                                     icon: 1
                                 });*/
                        }
                    }
                });
            }

        }


        //景点消费
        function consume (id , orderStatus) {
            if (orderStatus != '1') {
                alert("当前订单状态下不可消费")
            } else  {
                $.ajax({
                    url:"/fore_orders/consume",
                    type:"post",//请求类型
                    data:"orderId="+id,
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    dataType:"json",//服务端返回给浏览器的数据类型
                    success:function (res) {
                        if(res.code == 200) {
                            alert(res.msg)
                            setTimeout(function(){
                                window.location.reload(true)
                            },1000);
                            /*layer.msg(
                                res.msg,{
                                    icon: 1
                                });*/
                        } else {
                            alert(res.msg)
                            /* layer.msg(
                                 res.msg,{
                                     icon: 1
                                 });*/
                        }
                    }
                });
            }
        }

        //取消订单
        function cancelOrder(id , createTime , orderStatus , kind) {
            if (orderStatus != "0") {
                alert("当前订单状态下不可取消订单")
                /*layer.msg(
                   "当前订单状态下不可取消订单",{
                        icon: 1
                    });*/
                return;
            }
            var requestUrl = "/fore_orders/cancelOrder";
            if (kind == "2") {
                requestUrl = "/fore_hotelOrder/cancelOrder";
            }

            //1分钟的取消订单过期时间设置，1分钟前不用审核，1分钟后要审核
            var originalTime = Date.parse(createTime)
            var expireTime = new Date().setTime(originalTime+1 * 60 * 1000);
            var currentTime = new Date().getTime();
            if (currentTime >= expireTime) {
                kind--;
                alert("订单超过自助取消期限，需等商家审核!!!")
                $.ajax({
                    url:"/checkingTask/cancelOrder",
                    type:"post",//请求类型
                    data:"orderId="+id+"&orderType="+kind,
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    dataType:"json",//服务端返回给浏览器的数据类型
                    success:function (res) {
                        if(res.code == 200) {
                            alert(res.msg)
                            /*layer.msg(
                                res.msg,{
                                    icon: 1
                                });*/
                        } else {
                            alert(res.msg)
                            /* layer.msg(
                                 res.msg,{
                                     icon: 1
                                 });*/
                        }
                    }
                });
            } else {
                $.ajax({
                    url:requestUrl,
                    type:"post",//请求类型
                    data:"orderId="+id,
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    dataType:"json",//服务端返回给浏览器的数据类型
                    success:function (res) {
                        if(res.code == 200) {
                            alert(res.msg)
                            /*layer.msg(
                                res.msg,{
                                    icon: 1
                                });*/
                            $("#login_modal").modal('hide');
                        } else {
                            alert(res.msg)
                            /* layer.msg(
                                 res.msg,{
                                     icon: 1
                                 });*/
                        }
                    }
                });
            }
            /*var object = createTime.toString();
            var time =   createTime.toTimeString();
            var localObject = createTime.toLocaleString();
            var loaclTime = createTime.toLocaleTimeString();
            alert(object+"  " +time+"  "+ localObject +"  "+loaclTime);*/

        }

        //付款
        function toPayOrderPage(id , kind , orderStatus) {
            if (orderStatus != '0' && orderStatus != '14') {
                alert("当前订单状态下不可付款")
                return ;
            }
                var url = "/fore_orders/toPayOrderPage?orderId=";
                if (kind == "2") {
                    url = "/fore_hotelOrder/toPayOrderPage?orderId=";
                }
            location.href=url+id;
           /* $.getJSON("/fore_orders/toPayOrderPage?orderId="+id,function (data) {
                if (data.code==200){
                    layer.msg(data.msg);
                }else {
                    layer.msg(data.msg);
                }
            })*/
        }

        //升级为VIP
        $("#promotingVip").click(function () {
            //数据库设计，在user表加上是否为会员的标志，新增字段
            //微信登录，获取关联记录，存在就可以升级，不存在就不能升级（友好提示）
            //手机用户，升级过就不能升级，直接显示积分，这里可能会有if-else
            //记得，用户登录才能显示升级会员按钮
            $.getJSON("/user/promotingVip",function (data) {
                if (data.code==200){
                    location.href="/dist/vipPayFor"
                    /* var postSubmit=document.createElement('form');
                     postSubmit.style.display='none';
                     postSubmit.action='/gogo/zhifu';
                     postSubmit.method='post';
                     postSubmit.innerHTML='<input type="hidden" name="id" value="'+data.data.id+'"/>';
                     document.body.appendChild(postSubmit);
                     postSubmit.submit();*/

                }else {

                }
            })
        })

        //评价
        function star1(id) {
            console.log(id+"=========")
            $("#myModal11").modal('show');
            opinions1(id)
        }

        //获取积分
        $(function () {
            if ($("#currentUserId").val() == null || $("#isVip").val() == "0") {
                return ;
            }
            $.ajax({
                url:"/fore_totalScore/getTotalScoreByUserId",
                type:"get",//请求类型
                contentType: "application/json; charset=utf-8",
                dataType:"json",//服务端返回给浏览器的数据类型
                success:function (res) {
                    if(res.code == 200) {
                        $("#score").html(res.data);
                    } else {
                        alert(res.msg)
                    }
                }
            });
        })

        //签到
        function sign() {
            $.ajax({
                url:"/fore_scoreDetail/sign",
                type:"get",//请求类型
                contentType: "application/json; charset=utf-8",
                dataType:"json",//服务端返回给浏览器的数据类型
                success:function (res) {
                    if(res.code == 200) {
                        if (res.data != null) {
                            $("#score").html(res.data);
                        }
                        alert(res.msg)
                    } else {
                        alert(res.msg)
                    }
                }
            });
        }

        function opinions1(id){
            //        设置两个状态的星星
            var emptyStar="☆";
            var fullStar="★";
//        li鼠标移入事件
            $("ul[class=box] li").mouseenter(function(){
                $(this).text(fullStar).prevAll().text(fullStar).end().nextAll().text(emptyStar);
            });
//        li鼠标离开事件
            $("ul[class=box] li").mouseleave(function(){
                $("ul[class=box] li").text(emptyStar);
                $("ul[class=box] li.current").text(fullStar).prevAll().text(fullStar).end().nextAll().text(emptyStar);

            });
//        li点击事件
            $("ul[class=box] li").click(function(){
                if($(this).hasClass("current")){
                    $(this).removeAttr("class");
                }else{
                    $(this).attr("class","current").siblings().removeAttr("class");
                }
            })
//        button点击事件
            $("#submit1").click(function(){
                var boo=false;
                for(var i=0;i<$("ul>li").length;i++){
                    if($("ul>li").hasClass("current")){
                        boo=true;
                    }
                }
                if(boo){
                    var star=($("ul>li.current").index()+1)
                    var data = JSON.stringify({id:id,start:star})
                    $.ajax({
                        contentType: "application/json; charset=utf-8",
                        type:"POST",
                        url:"/travel/hotel?id="+id+"&start="+star,
                        data:data,
                        dataType:"JSON",
                        success:function (data) {
                            if (data.code==1){
                                alert("感谢评分！")
                                $("#myModal11").modal('hide');
                                window.location.reload()

                            }
                        },error:function () {
                            alert("失败！")
                        }
                    })
                }else{
                    return alert("您还没有选择呢！");
                }
            })

        }

        function opinions(orderId , scenicId){


            //        设置两个状态的星星
            var emptyStar="☆";
            var fullStar="★";
//        li鼠标移入事件
            $("ul[class=box] li").mouseenter(function(){
                $(this).text(fullStar).prevAll().text(fullStar).end().nextAll().text(emptyStar);
            });
//        li鼠标离开事件
            $("ul[class=box] li").mouseleave(function(){
                $("ul[class=box] li").text(emptyStar);
                $("ul[class=box] li.current").text(fullStar).prevAll().text(fullStar).end().nextAll().text(emptyStar);

            });
//        li点击事件
            $("ul[class=box] li").click(function(){
                if($(this).hasClass("current")){
                    $(this).removeAttr("class");
                }else{
                    $(this).attr("class","current").siblings().removeAttr("class");
                }
            })
//        button点击事件
            $("#submit").click(function(){
                var boo=false;
                for(var i=0;i<$("ul>li").length;i++){
                    if($("ul>li").hasClass("current")){
                        boo=true;
                    }
                }
                if(boo){
                    var star=($("ul>li.current").index()+1)
                    var data = JSON.stringify({orderId:orderId , star:star})
                    alert(data);
                    $.ajax({
                        contentType: "application/json; charset=utf-8",
                        type:"POST",
                        url:"/fore_comment/comment",
                        data:data,
                        dataType:"JSON",
                        success:function (data) {
                            if (data.code==200){
                                alert("感谢评分！")
                                $("#myModal111").modal('hide');
                                window.location.reload()

                            }
                        },error:function () {
                            alert("失败！")
                        }
                    })
                }else{
                    return alert("您还没有选择呢！");
                }
            })

        }
        $(function(){
            if($.cookie("nickName")){
                $("#login")[0].style.display = "none"
                $("#adminLogin")[0].style.display = "none"
                $("#regist")[0].style.display = "none"
                $("#isWeCatShow")[0].style.display = "";
                $("#nickName").html($.cookie("nickName"))
            }
        })

    </script>
</header>

</body>
</html>
<script type="text/javascript">
    layui.use(['table', 'layer', 'form'], function (){
    var table = layui.table
        ,table2 = layui.table
        ,layer = layui.layer
        ,form = layui.form;

    //关键！监听工具条
    table.on('tool(detail)', function(obj){  // detail为弹出框前的表格id
    var data = obj.data;
    if(obj.event === 'detail'){  // 监听”查看“按钮事件
    layer.open({  // 打开弹出框
        type: 1,  // 这个很关键！1为页面层
        title: '变化详情',
    shadeClose: true,  //开启遮罩关闭
        // shade: 0.8,
        area: ['70%', '90%'],
    maxmin: true,
        content: '<div class="layui-container" style="width: 98%"><table id="transfer" lay-filter="transfer" class=""></table></div>',
    // 弹出层表格定义
    success: function () {
        table2.render({
            elem: '#transfer'  // 弹出层表格id
            ,url: "{% url 'index:transfers' %}"  // 后端请求URL地址
            ,where: {  // derail表格的值
        'diff_date': data.diff_date
                ,'source': data.data_center
                ,'direction': data.change
                ,'num': data.num
        }
        // ,method: \'post\'
    ,page: true
            // 以下为transfer表格的定义
            ,cols: [[
            {field: 'diff_date', title: '时间', width: 150}
            ,{field: 'source', title: '数据中心'}
            ,{field: 'direction', title: '方向', width: 80}
            ,{field: 'destinatio', title: '来源/去处'}
            ,{field: 'serial_num', title: '序列号', width: 230}
            ,{field: 'brand', title: '品牌'}
            ,{field: 'model', title: '型号', width: 200}
            ,{field: 'purchase', title: '采购编号'}
    ]]
    ,response: {
            statusName:'code' //规定数据状态的字段名称，默认：code
                ,statusCode: 10000 //规定成功的状态码，默认：0
                ,msgName: 'message' //规定状态信息的字段名称，默认：msg
                ,countName: 'total' //规定数据总数的字段名称，默认：count
                ,dataName: 'data' //规定数据列表的字段名称，默认：data
        }
    })
    }
    });
    }
    });
    });
</script>


